<template>
    <el-dropdown trigger="click" @command="handleLanguageChange">
        <div>
        <svg-icon icon-class="language" :size="size" />
        </div>
        <template #dropdown>
        <el-dropdown-menu>
            <el-dropdown-item
            v-for="item in langOptions"
            :key="item.value"
            :disabled="language === item.value"
            :command="item.value"
            >
            {{ item.label }}
            </el-dropdown-item>
        </el-dropdown-menu>
        </template>
    </el-dropdown>
</template>
<script setup>
import { ref } from 'vue';
defineProps({
  size: {
    type: String,
    default: '1.5em',
  },
});
const language = ref('zh-cn');
const langOptions = [
  { label: "中文", value: 'zh-cn' },
  { label: "English", value: 'en' },
];

function handleLanguageChange(lang) {
    language.value = lang;
}
</script>